<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDBusConnectionInterface Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDBusConnectionInterface Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusConnectionInterface class provides access to the D-Bus
bus daemon service. <a href="#details">More...</a></p>

<p>Inherits <a href="qdbusabstractinterface.html">QDBusAbstractInterface</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdbusconnectioninterface.html#RegisterServiceReply-enum">RegisterServiceReply</a></b> { ServiceNotRegistered, ServiceRegistered, ServiceQueued }</li><li><div class="fn" />enum <b><a href="qdbusconnectioninterface.html#ServiceQueueOptions-enum">ServiceQueueOptions</a></b> { DontQueueService, QueueService, ReplaceExistingService }</li><li><div class="fn" />enum <b><a href="qdbusconnectioninterface.html#ServiceReplacementOptions-enum">ServiceReplacementOptions</a></b> { DontAllowReplacement, AllowReplacement }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusconnectioninterface.html#connectNotify">connectNotify</a></b> (<i>self</i>, SIGNAL())</li><li><div class="fn" /><b><a href="qdbusconnectioninterface.html#disconnectNotify">disconnectNotify</a></b> (<i>self</i>, SIGNAL())</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#isServiceRegistered">isServiceRegistered</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#registeredServiceNames">registeredServiceNames</a></b> (<i>self</i>)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#registerService">registerService</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>, ServiceQueueOptions&#160;<i>qoption</i>&#160;=&#160;QDBusConnectionInterface.DontQueueService, ServiceReplacementOptions&#160;<i>roption</i>&#160;=&#160;QDBusConnectionInterface.DontAllowReplacement)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#serviceOwner">serviceOwner</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#servicePid">servicePid</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#serviceUid">serviceUid</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#startService">startService</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QDBusReply <b><a href="qdbusconnectioninterface.html#unregisterService">unregisterService</a></b> (<i>self</i>, QString&#160;<i>serviceName</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qdbusconnectioninterface.html#callWithCallbackFailed">callWithCallbackFailed</a></b> (const QDBusError&amp;,const QDBusMessage&amp;)</li><li><div class="fn" />void <b><a href="qdbusconnectioninterface.html#serviceOwnerChanged">serviceOwnerChanged</a></b> (const QString&amp;,const QString&amp;,const QString&amp;)</li><li><div class="fn" />void <b><a href="qdbusconnectioninterface.html#serviceRegistered">serviceRegistered</a></b> (const QString&amp;)</li><li><div class="fn" />void <b><a href="qdbusconnectioninterface.html#serviceUnregistered">serviceUnregistered</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusConnectionInterface class provides access to the D-Bus
bus daemon service.</p>
<p>The D-Bus bus server daemon provides one special interface
<tt>org.freedesktop.DBus</tt> that allows clients to access certain
properties of the bus, such as the current list of clients
connected. The QDBusConnectionInterface class provides access to
that interface.</p>
<p>The most common uses of this class are to register and
unregister service names on the bus using the <a href="qdbusconnectioninterface.html#registerService">registerService</a>()
and <a href="qdbusconnectioninterface.html#unregisterService">unregisterService</a>()
functions, query about existing names using the <a href="qdbusconnectioninterface.html#isServiceRegistered">isServiceRegistered</a>(),
<a href="qdbusconnectioninterface.html#registeredServiceNames-prop">registeredServiceNames</a>()
and <a href="qdbusconnectioninterface.html#serviceOwner">serviceOwner</a>()
functions, and to receive notification that a client has registered
or de-registered through the <a href="qdbusconnectioninterface.html#serviceRegistered">serviceRegistered</a>(),
<a href="qdbusconnectioninterface.html#serviceUnregistered">serviceUnregistered</a>()
and <a href="qdbusconnectioninterface.html#serviceOwnerChanged">serviceOwnerChanged</a>()
signals.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="RegisterServiceReply-enum" />QDBusConnectionInterface.RegisterServiceReply</h3><p>The possible return values from <a href="qdbusconnectioninterface.html#registerService">registerService</a>():</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.ServiceNotRegistered</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The call failed and the service name was not
registered.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.ServiceRegistered</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The caller is now the owner of the service
name.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.ServiceQueued</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The caller specified the <a href="qdbusconnectioninterface.html#ServiceQueueOptions-enum">QueueService</a>
flag and the service was already registered, so we are in
queue.</td>
</tr>
</table>
<p>The <a href="qdbusconnectioninterface.html#serviceRegistered">serviceRegistered</a>()
signal will be emitted when the service is acquired by this
application.</p>


<h3 class="fn"><a name="ServiceQueueOptions-enum" />QDBusConnectionInterface.ServiceQueueOptions</h3><p>Flags for determining how a service registration should behave,
in case the service name is already registered.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.DontQueueService</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">If an application requests a name that is
already owned, no queueing will be performed. The
registeredService() call will simply fail. This is the
default.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.QueueService</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Attempts to register the requested service,
but do not try to replace it if another application already has it
registered. Instead, simply put this application in queue, until it
is given up. The <a href="qdbusconnectioninterface.html#serviceRegistered">serviceRegistered</a>()
signal will be emitted when that happens.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.ReplaceExistingService</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">If another application already has the service
name registered, attempt to replace it.</td>
</tr>
</table>
<p><b>See also</b> <a href="qdbusconnectioninterface.html#ServiceReplacementOptions-enum">ServiceReplacementOptions</a>.</p>


<h3 class="fn"><a name="ServiceReplacementOptions-enum" />QDBusConnectionInterface.ServiceReplacementOptions</h3><p>Flags for determining if the D-Bus server should allow another
application to replace a name that this application has registered
with the <a href="qdbusconnectioninterface.html#ServiceQueueOptions-enum">ReplaceExistingService</a>
option.</p>
<p>The possible values are:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.DontAllowReplacement</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Do not allow another application to replace
us. The service must be explicitly unregistered with <a href="qdbusconnectioninterface.html#unregisterService">unregisterService</a>()
for another application to acquire it. This is the default.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QDBusConnectionInterface.AllowReplacement</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Allow other applications to replace us with
the <a href="qdbusconnectioninterface.html#ServiceQueueOptions-enum">ReplaceExistingService</a>
option to <a href="qdbusconnectioninterface.html#registerService">registerService</a>()
without intervention. If that happens, the <a href="qdbusconnectioninterface.html#serviceUnregistered">serviceUnregistered</a>()
signal will be emitted.</td>
</tr>
</table>
<p><b>See also</b> <a href="qdbusconnectioninterface.html#ServiceQueueOptions-enum">ServiceQueueOptions</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="connectNotify" />QDBusConnectionInterface.connectNotify (<i>self</i>, SIGNAL())</h3><h3 class="fn"><a name="disconnectNotify" />QDBusConnectionInterface.disconnectNotify (<i>self</i>, SIGNAL())</h3><h3 class="fn"><a name="isServiceRegistered" />QDBusReply QDBusConnectionInterface.isServiceRegistered (<i>self</i>, QString&#160;<i>serviceName</i>)</h3><p>Returns true if the service name <i>serviceName</i> has is
currently registered.</p>


<h3 class="fn"><a name="registeredServiceNames" />QDBusReply QDBusConnectionInterface.registeredServiceNames (<i>self</i>)</h3><h3 class="fn"><a name="registerService" />QDBusReply QDBusConnectionInterface.registerService (<i>self</i>, QString&#160;<i>serviceName</i>, <a href="qdbusconnectioninterface.html#ServiceQueueOptions-enum">ServiceQueueOptions</a>&#160;<i>qoption</i>&#160;=&#160;QDBusConnectionInterface.DontQueueService, <a href="qdbusconnectioninterface.html#ServiceReplacementOptions-enum">ServiceReplacementOptions</a>&#160;<i>roption</i>&#160;=&#160;QDBusConnectionInterface.DontAllowReplacement)</h3><p>Requests to register the service name <i>serviceName</i> on the
bus. The <i>qoption</i> flag specifies how the D-Bus server should
behave if <i>serviceName</i> is already registered. The
<i>roption</i> flag specifies if the server should allow another
application to replace our registered name.</p>
<p>If the service registration succeeds, the <a href="qdbusconnectioninterface.html#serviceRegistered">serviceRegistered</a>()
signal will be emitted. If we are placed in queue, the signal will
be emitted when we obtain the name. If <i>roption</i> is <a href="qdbusconnectioninterface.html#ServiceReplacementOptions-enum">AllowReplacement</a>,
the <a href="qdbusconnectioninterface.html#serviceUnregistered">serviceUnregistered</a>()
signal will be emitted if another application replaces this
one.</p>
<p><b>See also</b> <a href="qdbusconnectioninterface.html#unregisterService">unregisterService</a>().</p>


<h3 class="fn"><a name="serviceOwner" />QDBusReply QDBusConnectionInterface.serviceOwner (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Returns the unique connection name of the primary owner of the
name <i>name</i>. If the requested name doesn't have an owner,
returns a <tt>org.freedesktop.DBus.Error.NameHasNoOwner</tt>
error.</p>


<h3 class="fn"><a name="servicePid" />QDBusReply QDBusConnectionInterface.servicePid (<i>self</i>, QString&#160;<i>serviceName</i>)</h3><p>Returns the Unix Process ID (PID) for the process currently
holding the bus service <i>serviceName</i>.</p>


<h3 class="fn"><a name="serviceUid" />QDBusReply QDBusConnectionInterface.serviceUid (<i>self</i>, QString&#160;<i>serviceName</i>)</h3><p>Returns the Unix User ID (UID) for the process currently holding
the bus service <i>serviceName</i>.</p>


<h3 class="fn"><a name="startService" />QDBusReply QDBusConnectionInterface.startService (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Requests that the bus start the service given by the name
<i>name</i>.</p>


<h3 class="fn"><a name="unregisterService" />QDBusReply QDBusConnectionInterface.unregisterService (<i>self</i>, QString&#160;<i>serviceName</i>)</h3><p>Releases the claim on the bus service name <i>serviceName</i>,
that had been previously registered with <a href="qdbusconnectioninterface.html#registerService">registerService</a>().
If this application had ownership of the name, it will be released
for other applications to claim. If it only had the name queued, it
gives up its position in the queue.</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="callWithCallbackFailed" />void callWithCallbackFailed (const QDBusError&amp;,const QDBusMessage&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when there is an error during a <a href="qdbusconnection.html#callWithCallback">QDBusConnection.callWithCallback</a>().
<i>error</i> specifies the error. <i>call</i> is the message that
couldn't be delivered.</p>
<p><b>See also</b> <a href="qdbusconnection.html#callWithCallback">QDBusConnection.callWithCallback</a>().</p>


<h3 class="fn"><a name="serviceOwnerChanged" />void serviceOwnerChanged (const QString&amp;,const QString&amp;,const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the D-Bus server whenever a service
ownership change happens in the bus, including apparition and
disparition of names.</p>
<p>This signal means the application <i>oldOwner</i> lost ownership
of bus name <i>name</i> to application <i>newOwner</i>. If
<i>oldOwner</i> is an empty string, it means the name <i>name</i>
has just been created; if <i>newOwner</i> is empty, the name
<i>name</i> has no current owner and is no longer available.</p>
<p><b>Note:</b> connecting to this signal will make the application
listen for and receive every single service ownership change on the
bus. Depending on how many services are running, this make the
application be activated to receive more signals than it needs. To
avoid this problem, use the <a href="qdbusservicewatcher.html">QDBusServiceWatcher</a> class, which can
listen for specific changes.</p>


<h3 class="fn"><a name="serviceRegistered" />void serviceRegistered (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the D-Bus server when the bus service
name (unique connection name or well-known service name) given by
<i>serviceName</i> is acquired by this application.</p>
<p>Acquisition happens after this application has requested a name
using <a href="qdbusconnectioninterface.html#registerService">registerService</a>().</p>


<h3 class="fn"><a name="serviceUnregistered" />void serviceUnregistered (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the D-Bus server when this application
loses ownership of the bus service name given by
<i>serviceName</i>.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>